package com.tjsinfo.tjsoa.baobiao.bo;

import java.util.List;
import java.util.Map;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;

import com.tjsinfo.tjsoa.Dao.IHibernateDao;
import com.tjsinfo.tjsoa.Dao.IQbcDao;
import com.tjsinfo.tjsoa.baobiao.vo.THqBBSet;
import com.tjsinfo.tjsoa.Dao.ISpringDao;


/**
 * 计划生育用户管理
 * 
 * @author 天津市电子计算机研究所
 *
 */
	
public class THqBBSetManage implements IHqBBSetManage{
	private IQbcDao qbcDao;
	private IHibernateDao hibernateDao;
	private ISpringDao springDao;
	
	public ISpringDao getSpringDao() {
		return springDao;
	}

	public void setSpringDao(ISpringDao springDao) {
		this.springDao = springDao;
	}
	
	public IHibernateDao getHibernateDao() {
		return hibernateDao;
	}

	public void setHibernateDao(IHibernateDao hibernateDao) {
		this.hibernateDao = hibernateDao;
	}

	public IQbcDao getQbcDao() {
		return qbcDao;
	}

	public void setQbcDao(IQbcDao qbcDao) {
		this.qbcDao = qbcDao;
	}
	
	/**
	 * 根据id查找
	 * @param id
	 * @return
	 */
	public THqBBSet findByid(Integer id) {
		// TODO Auto-generated method stub
		DetachedCriteria criteria = DetachedCriteria.forClass(THqBBSet.class); 
		criteria.add(Restrictions.eq("id", id));
		return  (THqBBSet) qbcDao.getCriteria(criteria).iterator().next();
	}

	/**
	 * 获取截止日期
	 */
	public String getDeadline(String bbid) {
		// TODO Auto-generated method stub
		List<Map<String, String>> tempList = springDao.commonSelect(new String[]{"deadline"}, "SELECT deadline FROM t_hq_baobiao_set WHERE id="+bbid);
		return tempList.get(0).get("deadline");
	}

	public Boolean setDeadline(String deadlineString,String bbid) {
		// TODO Auto-generated method stub
		return springDao.runningSql("UPDATE t_hq_baobiao_set SET deadline = '" + deadlineString.trim()+ "'WHERE id ="+bbid);
	}
	
	

}


